package com.ifamily.domain.user;

import java.io.Serializable;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToOne;
import javax.persistence.Table;

import org.hibernate.validator.constraints.Length;

@Entity
@Table(name="USERS")
public class User implements Serializable {

	private static final long serialVersionUID = 8179300958606900394L;
	@Id
	@GeneratedValue
	@Column(name="ID")
	private int id;
	@Column(name="USERNAME",length=50,nullable=false)
	@Length(max=50)
	private String username;
	@Column(name="FIRST_NAME",length=50)
	@Length(max=50)
	private String firstName;
	@Column(name="SECOND_NAME",length=50)
	@Length(max=50)
	private String secondName;
	@Column(name="EMAIL",length=50)
	@Length(max=50)
	private String email;
	@Column(name="PASSWORD",length=50)
	@Length(max=50)
	private String password;
	@OneToOne(cascade = CascadeType.ALL)
	private Address address;
	@OneToOne(fetch = FetchType.LAZY, mappedBy = "user", cascade = CascadeType.ALL)
	private UserProperties userProperties;
	
	
	
	public int getId() {
		return id;
	}
	public void setId(int id) {
		this.id = id;
	}
	public String getUsername() {
		return username;
	}
	public void setUsername(String username) {
		this.username = username;
	}
	public String getFirstName() {
		return firstName;
	}
	public void setFirstName(String firstName) {
		this.firstName = firstName;
	}
	public String getSecondName() {
		return secondName;
	}
	public void setSecondName(String secondName) {
		this.secondName = secondName;
	}
	public String getEmail() {
		return email;
	}
	public void setEmail(String email) {
		this.email = email;
	}
	public String getPassword() {
		return password;
	}
	public void setPassword(String password) {
		this.password = password;
	}

	public Address getAddress() {
		return address;
	}
	public void setAddress(Address address) {
		this.address = address;
	}
	public UserProperties getUserProperties() {
		return userProperties;
	}
	public void setUserProperties(UserProperties userProperties) {
		this.userProperties = userProperties;
	}
	
	
}
